validated

fun validated(str: String, vars: Set<Char> = setOf()): ValidatedExpression

Generates a validated Expression for use in configs

Return

ValidatedExpression wrapping the passed string as it's default expression

Author

fzzyhmstrs

Since

0.2.0

Parameters

str

String. the default math expression to be used in the ValidatedExpression

vars

Set defining the relevant and allowable variable names

Throws

if the passed string is not parsable

Samples

import me.fzzyhmstrs.fzzy_config.FC
import me.fzzyhmstrs.fzzy_config.util.EnumTranslatable
import me.fzzyhmstrs.fzzy_config.util.Expression
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validated
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validatedColor
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validatedIds
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validatedList
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validatedRegistry
import me.fzzyhmstrs.fzzy_config.validation.Shorthand.validatedTag
import me.fzzyhmstrs.fzzy_config.validation.minecraft.ValidatedIdentifier
import net.minecraft.item.SwordItem
import net.minecraft.registry.Registries
import net.minecraft.registry.tag.BlockTags
import net.minecraft.registry.tag.ItemTags
import net.minecraft.util.Identifier
import java.awt.Color
import java.util.function.BiPredicate

fun main() { 
   //sampleStart 
   //Shorthand math Expression. This is directly in the Expression class itself, not in the Shorthand object
val shorthandMath = Expression.validated("x * 0.5", setOf('x')) 
   //sampleEnd
}